package com.tanhua.admin.controller;

import com.tanhua.admin.service.PanelService;
import com.tanhua.model.vo.AnalysisSummaryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class PanelController {
    @Autowired
    private PanelService panelService;

    /**
     * 查询首页的基本信息
     * @return
     */
    @GetMapping("/summary")
    public AnalysisSummaryVo findSummary() throws ParseException {
        AnalysisSummaryVo analysisSummaryVo = panelService.findSummary();
        return analysisSummaryVo;
    }


    /**
     * 新增、活跃用户、次日留存率
     *
     * @return
     */
    @GetMapping("/users")
    public ResponseEntity findByUsers(String sd, String ed, String type) {
        Map map = panelService.findByUsers(sd, ed, type);
        return ResponseEntity.ok(map);
    }

}
